﻿// Version:1
// Author:Sanket Naik
// Date:July-21-2010 
// Comments:
// 
// 
// 

using System;
using System.Linq;
using System.Data.Linq;
using System.Data.Linq.Mapping;
using System.Runtime.Serialization;
using ManagedServices.Common.DataTransferObject;
using System.ComponentModel;

namespace ManagedServices.DataTransferObjects
{
     /// <summary>
    /// The DataTransferObject for representing a sub service 
    /// </summary>
    [DataContract]
    [global::System.Data.Linq.Mapping.TableAttribute(Name = "dbo.Msf_Tbl_SubService")]
    public partial class SubService : INotifyPropertyChanging, INotifyPropertyChanged, ICommonDto
    {

        private static PropertyChangingEventArgs emptyChangingEventArgs = new PropertyChangingEventArgs(String.Empty);

        private System.Guid _Msf_Col_SubServiceID;

        private string _Msf_Col_SubServiceName;

        private string _Msf_Col_SubServiceDescription;

        private string _Msf_Col_UniqeURN;

        private short _Msf_Col_NumberOfInstances;

        private System.Guid _Msf_Col_ContainerServiceID;

        private System.Guid _Msf_Col_AssociatedIdentityID;

        private System.Guid _Msf_Col_SubServiceRunConfigID;

        private System.Guid _Msf_Col_CreatedBy;

        private System.Nullable<System.Guid> _Msf_Col_ModifiedBy;

        private System.DateTime _Msf_Col_CreatedOn;

        private System.Nullable<System.DateTime> _Msf_Col_ModifiedOn;

        #region Extensibility Method Definitions
        partial void OnLoaded();
        partial void OnValidate(System.Data.Linq.ChangeAction action);
        partial void OnCreated();
        partial void OnSubServiceIDChanging(System.Guid value);
        partial void OnSubServiceIDChanged();
        partial void OnSubServiceNameChanging(string value);
        partial void OnSubServiceNameChanged();
        partial void OnSubServiceDescriptionChanging(string value);
        partial void OnSubServiceDescriptionChanged();
        partial void OnUniqeURNChanging(string value);
        partial void OnUniqeURNChanged();
        partial void OnNumberOfInstancesChanging(short value);
        partial void OnNumberOfInstancesChanged();
        partial void OnContainerServiceIDChanging(System.Guid value);
        partial void OnContainerServiceIDChanged();
        partial void OnAssociatedIdentityIDChanging(System.Guid value);
        partial void OnAssociatedIdentityIDChanged();
        partial void OnSubServiceRunConfigIDChanging(System.Guid value);
        partial void OnSubServiceRunConfigIDChanged();
        partial void OnCreatedByChanging(System.Guid value);
        partial void OnCreatedByChanged();
        partial void OnModifiedByChanging(System.Nullable<System.Guid> value);
        partial void OnModifiedByChanged();
        partial void OnCreatedOnChanging(System.DateTime value);
        partial void OnCreatedOnChanged();
        partial void OnModifiedOnChanging(System.Nullable<System.DateTime> value);
        partial void OnModifiedOnChanged();
        #endregion

        /// <summary>
        /// Ctor
        /// </summary>
        public SubService()
        {
            OnCreated();
        }

        /// <summary>
        /// The Unique Identifier for a SubService 
        /// </summary>
        [DataMember]
        [global::System.Data.Linq.Mapping.ColumnAttribute(Name = "Msf_Col_SubServiceID", Storage = "_Msf_Col_SubServiceID", DbType = "UniqueIdentifier NOT NULL", IsPrimaryKey = true)]
        public System.Guid SubServiceID
        {
            get
            {
                return this._Msf_Col_SubServiceID;
            }
            set
            {
                if ((this._Msf_Col_SubServiceID != value))
                {
                    this.OnSubServiceIDChanging(value);
                    this.SendPropertyChanging();
                    this._Msf_Col_SubServiceID = value;
                    this.SendPropertyChanged("SubServiceID");
                    this.OnSubServiceIDChanged();
                }
            }
        }

        /// <summary>
        /// The Name for a Sub Service 
        /// </summary>
        [DataMember]
        [global::System.Data.Linq.Mapping.ColumnAttribute(Name = "Msf_Col_SubServiceName", Storage = "_Msf_Col_SubServiceName", DbType = "NVarChar(150) NOT NULL", CanBeNull = false)]
        public string SubServiceName
        {
            get
            {
                return this._Msf_Col_SubServiceName;
            }
            set
            {
                if ((this._Msf_Col_SubServiceName != value))
                {
                    this.OnSubServiceNameChanging(value);
                    this.SendPropertyChanging();
                    this._Msf_Col_SubServiceName = value;
                    this.SendPropertyChanged("SubServiceName");
                    this.OnSubServiceNameChanged();
                }
            }
        }

        /// <summary>
        /// A Short Description talking about what the Sub Service does
        /// </summary>
        [DataMember]
        [global::System.Data.Linq.Mapping.ColumnAttribute(Name = "Msf_Col_SubServiceDescription", Storage = "_Msf_Col_SubServiceDescription", DbType = "NVarChar(500) NOT NULL", CanBeNull = false)]
        public string SubServiceDescription
        {
            get
            {
                return this._Msf_Col_SubServiceDescription;
            }
            set
            {
                if ((this._Msf_Col_SubServiceDescription != value))
                {
                    this.OnSubServiceDescriptionChanging(value);
                    this.SendPropertyChanging();
                    this._Msf_Col_SubServiceDescription = value;
                    this.SendPropertyChanged("SubServiceDescription");
                    this.OnSubServiceDescriptionChanged();
                }
            }
        }

        /// <summary>
        /// The Unique URN that identifies the Sub Service
        /// </summary>
        [DataMember]
        [global::System.Data.Linq.Mapping.ColumnAttribute(Name = "Msf_Col_UniqeURN", Storage = "_Msf_Col_UniqeURN", DbType = "NVarChar(250) NOT NULL", CanBeNull = false)]
        public string UniqeURN
        {
            get
            {
                return this._Msf_Col_UniqeURN;
            }
            set
            {
                if ((this._Msf_Col_UniqeURN != value))
                {
                    this.OnUniqeURNChanging(value);
                    this.SendPropertyChanging();
                    this._Msf_Col_UniqeURN = value;
                    this.SendPropertyChanged("UniqeURN");
                    this.OnUniqeURNChanged();
                }
            }
        }

        /// <summary>
        /// The number of Parallel instance that need to be run for the SubService 
        /// </summary>
        [DataMember]
        [global::System.Data.Linq.Mapping.ColumnAttribute(Name="Msf_Col_NumberOfInstances", Storage = "_Msf_Col_NumberOfInstances", DbType = "SmallInt NOT NULL")]
        public short NumberOfInstances
        {
            get
            {
                return this._Msf_Col_NumberOfInstances;
            }
            set
            {
                if ((this._Msf_Col_NumberOfInstances != value))
                {
                    this.OnNumberOfInstancesChanging(value);
                    this.SendPropertyChanging();
                    this._Msf_Col_NumberOfInstances = value;
                    this.SendPropertyChanged("NumberOfInstances");
                    this.OnNumberOfInstancesChanged();
                }
            }
        }

        /// <summary>
        /// The Unique Identifier for the Container Service that holds the SubService Instance
        /// </summary>
        [DataMember]
        [global::System.Data.Linq.Mapping.ColumnAttribute(Name = "Msf_Col_ContainerServiceID", Storage = "_Msf_Col_ContainerServiceID", DbType = "UniqueIdentifier NOT NULL")]
        public System.Guid ContainerServiceID
        {
            get
            {
                return this._Msf_Col_ContainerServiceID;
            }
            set
            {
                if ((this._Msf_Col_ContainerServiceID != value))
                {
                    this.OnContainerServiceIDChanging(value);
                    this.SendPropertyChanging();
                    this._Msf_Col_ContainerServiceID = value;
                    this.SendPropertyChanged("ContainerServiceID");
                    this.OnContainerServiceIDChanged();
                }
            }
        }

        /// <summary>
        /// The Associated Identity using which the Sub Service Run's
        /// </summary>
        [DataMember]
        [global::System.Data.Linq.Mapping.ColumnAttribute(Name = "Msf_Col_AssociatedIdentityID", Storage = "_Msf_Col_AssociatedIdentityID", DbType = "UniqueIdentifier NOT NULL")]
        public System.Guid AssociatedIdentityID
        {
            get
            {
                return this._Msf_Col_AssociatedIdentityID;
            }
            set
            {
                if ((this._Msf_Col_AssociatedIdentityID != value))
                {
                    this.OnAssociatedIdentityIDChanging(value);
                    this.SendPropertyChanging();
                    this._Msf_Col_AssociatedIdentityID = value;
                    this.SendPropertyChanged("AssociatedIdentityID");
                    this.OnAssociatedIdentityIDChanged();
                }
            }
        }

        /// <summary>
        /// Unique Identifier representing the Run Configuration for the Sub Service Instance
        /// </summary>
        [DataMember]
        [global::System.Data.Linq.Mapping.ColumnAttribute(Name = "Msf_Col_SubServiceRunConfigID", Storage = "_Msf_Col_SubServiceRunConfigID", DbType = "UniqueIdentifier NOT NULL")]
        public System.Guid SubServiceRunConfigID
        {
            get
            {
                return this._Msf_Col_SubServiceRunConfigID;
            }
            set
            {
                if ((this._Msf_Col_SubServiceRunConfigID != value))
                {
                    this.OnSubServiceRunConfigIDChanging(value);
                    this.SendPropertyChanging();
                    this._Msf_Col_SubServiceRunConfigID = value;
                    this.SendPropertyChanged("SubServiceRunConfigID");
                    this.OnSubServiceRunConfigIDChanged();
                }
            }
        }

        /// <summary>
        /// Primary key for the DTO
        /// </summary>
        public Guid KeyId { get { return SubServiceID; } set { SubServiceID = value; } }

        /// <summary>
        /// Created By
        /// </summary>
        [DataMember]
        [global::System.Data.Linq.Mapping.ColumnAttribute(Name = "Msf_Col_CreatedBy", Storage = "_Msf_Col_CreatedBy", DbType = "UniqueIdentifier NOT NULL")]
        public System.Guid CreatedBy
        {
            get
            {
                return this._Msf_Col_CreatedBy;
            }
            set
            {
                if ((this._Msf_Col_CreatedBy != value))
                {
                    this.OnCreatedByChanging(value);
                    this.SendPropertyChanging();
                    this._Msf_Col_CreatedBy = value;
                    this.SendPropertyChanged("CreatedBy");
                    this.OnCreatedByChanged();
                }
            }
        }

        /// <summary>
        /// Modified By
        /// </summary>
        [DataMember]
        [global::System.Data.Linq.Mapping.ColumnAttribute(Name = "Msf_Col_ModifiedBy", Storage = "_Msf_Col_ModifiedBy", DbType = "UniqueIdentifier")]
        public System.Nullable<System.Guid> ModifiedBy
        {
            get
            {
                return this._Msf_Col_ModifiedBy;
            }
            set
            {
                if ((this._Msf_Col_ModifiedBy != value))
                {
                    this.OnModifiedByChanging(value);
                    this.SendPropertyChanging();
                    this._Msf_Col_ModifiedBy = value;
                    this.SendPropertyChanged("ModifiedBy");
                    this.OnModifiedByChanged();
                }
            }
        }

        /// <summary>
        /// Created On
        /// </summary>
        [DataMember]
        [global::System.Data.Linq.Mapping.ColumnAttribute(Name = "Msf_Col_CreatedOn", Storage = "_Msf_Col_CreatedOn", DbType = "DateTime NOT NULL")]
        public System.DateTime CreatedOn
        {
            get
            {
                return this._Msf_Col_CreatedOn;
            }
            set
            {
                if ((this._Msf_Col_CreatedOn != value))
                {
                    this.OnCreatedOnChanging(value);
                    this.SendPropertyChanging();
                    this._Msf_Col_CreatedOn = value;
                    this.SendPropertyChanged("CreatedOn");
                    this.OnCreatedOnChanged();
                }
            }
        }

        /// <summary>
        /// Modified On
        /// </summary>
        [DataMember]
        [global::System.Data.Linq.Mapping.ColumnAttribute(Name = "Msf_Col_ModifiedOn", Storage = "_Msf_Col_ModifiedOn", DbType = "DateTime")]
        public System.Nullable<System.DateTime> ModifiedOn
        {
            get
            {
                return this._Msf_Col_ModifiedOn;
            }
            set
            {
                if ((this._Msf_Col_ModifiedOn != value))
                {
                    this.OnModifiedOnChanging(value);
                    this.SendPropertyChanging();
                    this._Msf_Col_ModifiedOn = value;
                    this.SendPropertyChanged("ModifiedOn");
                    this.OnModifiedOnChanged();
                }
            }
        }


        public event PropertyChangingEventHandler PropertyChanging;

        public event PropertyChangedEventHandler PropertyChanged;

        protected virtual void SendPropertyChanging()
        {
            if ((this.PropertyChanging != null))
            {
                this.PropertyChanging(this, emptyChangingEventArgs);
            }
        }

        protected virtual void SendPropertyChanged(String propertyName)
        {
            if ((this.PropertyChanged != null))
            {
                this.PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
            }
        }
    }

}
